<template>
  <div>
    <div class="bidding-body">
      <div class="bidding-title">
        <span>项目基本信息</span>
      </div>

      <div class="bidding-content">
        <Form :label-width="150">
          <div>
            <div class="bidding-item">
              <FormItem label="项目名称：" prop="name">
                <Input class="bidding-item-input" v-model="infodetail.name" disabled />
              </FormItem>
            </div>
            <div class="bidding-item">
              <FormItem label="承接部门：" prop="undertake_department_id">
                <Select
                  v-model="infodetail.undertake_departmentId"
                  style="width:200px"
                  :label-in-value="true"
                  disabled
                >
                  <Option v-for="item in dptList" :value="item.id" :key="item.id">{{ item.name }}</Option>
                </Select>
                <!-- <Input class="bidding-item-input" v-model="undertakeDepartmentIName" disabled/> -->
              </FormItem>
            </div>
            <div class="bidding-item">
              <FormItem label="完成部门：" prop="finish_department_id">
                <Select
                  v-model="infodetail.finishDepartmentId"
                  style="width:200px"
                  :label-in-value="true"
                  disabled
                >
                  <Option v-for="item in dptList" :value="item.id" :key="item.id">{{ item.name }}</Option>
                </Select>
                <!-- <Input class="bidding-item-input" v-model="finishDepartmentName"  disabled/> -->
              </FormItem>
            </div>
          </div>

          <div>
            <div class="bidding-item">
              <FormItem label="所属地区：" prop="province">
                <Input style="width:182px"  class="bidding-item-input" v-model="infodetail.province" disabled />
                <Input style="width:182px" class="bidding-item-input" v-model="infodetail.city" disabled />
                <Input style="width:182px" class="bidding-item-input" v-model="infodetail.area" disabled />
              </FormItem>
            </div>
          </div>

          <div>
            <div class="bidding-item">
              <FormItem label="行业类别：" prop="industryType">
                <Select
                  v-model="infodetail.industryType"
                  style="width:200px"
                  :label-in-value="true"
                  disabled
                >
                  <Option v-for="item in carerType" :value="item.id" :key="item.id">{{ item.name }}</Option>
                </Select>
                <!-- <Input class="bidding-item-input" v-model="infodetail.industryType" disabled/> -->
              </FormItem>
            </div>
            <div class="bidding-item">
              <FormItem label="项目类别：" prop="type">
                <Select
                  v-model="infodetail.type"
                  style="width:200px"
                  :label-in-value="true"
                  disabled
                >
                  <Option v-for="item in proType" :value="item.id" :key="item.id">{{ item.name }}</Option>
                </Select>
                <!-- <Input class="bidding-item-input" v-model="infodetail.type" disabled/> -->
              </FormItem>
            </div>
            <div class="bidding-item">
              <!-- <p>项目经费：</p> -->
              <FormItem label="项目经费：" prop="fund">
                <Input class="bidding-item-input" v-model="infodetail.fund" disabled />
              </FormItem>
            </div>
          </div>

          <div>
            <div class="bidding-item">
              <!-- <p>合同归属：</p> -->
              <FormItem label="合同归属：" prop="contractOrigin">
                <Input class="bidding-item-input" v-model="infodetail.contractOrigin" disabled />
              </FormItem>
            </div>
            <div class="bidding-item">
              <!-- <p>合同日期：</p> -->
              <FormItem label="合同日期：" prop="contractDate">
                <Input class="bidding-item-input" v-model="infodetail.contractDate" disabled />
              </FormItem>
            </div>
            <div class="bidding-item">
              <FormItem label="建设单位：" prop="development_organization">
                <Input
                  class="bidding-item-input"
                  v-model="infodetail.developmentOrganization"
                  disabled
                />
              </FormItem>
            </div>
          </div>

          <div>
            <div class="bidding-item">
              <!-- <p>任务下达日期：</p> -->
              <FormItem label="任务下达日期：" prop="startDate">
                <Input class="bidding-item-input" v-model="infodetail.startDate" disabled />
              </FormItem>
            </div>
            <div class="bidding-item">
              <!-- <p>要求完成天数：</p> -->
              <FormItem label="要求完成天数：" prop="timeLimit">
                <Input class="bidding-item-input" v-model="infodetail.timeLimit" disabled />
              </FormItem>
            </div>
            <div class="bidding-item">
              <!-- <p>税号：</p> -->
              <FormItem label="税号：" prop="taxNumber">
                <Input class="bidding-item-input" v-model="infodetail.taxNumber" disabled />
              </FormItem>
            </div>
          </div>

          <div>
            <div class="bidding-item">
              <!-- <p>联系人：</p> -->
              <FormItem label="联系人：" prop="contact">
                <Input class="bidding-item-input" v-model="infodetail.contact" disabled />
              </FormItem>
            </div>
            <div class="bidding-item">
              <!-- <p>联系方式：</p> -->
              <FormItem label="联系方式：" prop="contact_phone">
                <Input class="bidding-item-input" v-model="infodetail.contactPhone" disabled />
              </FormItem>
            </div>
            
            
          </div>

          <div>
            <div class="bidding-item">
              <!-- <p>开户银行：</p> -->
              <FormItem label="开户银行：" prop="bankName">
                <Input class="bidding-item-input" v-model="infodetail.bankName" disabled />
              </FormItem>
            </div>
            <div class="bidding-item">
              <!-- <p>银行账号：</p> -->
              <FormItem label="银行账号：" prop="bankAccount">
                <Input class="bidding-item-input" v-model="infodetail.bankAccount" disabled />
              </FormItem>
            </div>
            
          </div>

          <div>
            <div class="bidding-item">
              <FormItem label="备注：" prop="remark">
                <Input v-model.trim="infodetail.remark" type="textarea" style="width: 910px" disabled/>

                <!-- <Input type="areatext" v-model="infodetail.remark" disabled /> -->
              </FormItem>
            </div>
          </div>
        </Form>
      </div>
    </div>
  </div>
</template>
<script>
import axios from "axios";
export default {
  name: "easynews",
  data() {
    return {
      backrowid: {},
      undertakeDepartmentId: {},
      undertakeDepartmentIName: "", //承接部门名称
      finishDepartmentId: {},
      finishDepartmentName: "",
      editPerson: "", //承接人
      infodetail: {
        //不完整的
        projectId: "",

        undertakePersonId: "", //承接人ID
        taskNumber: "", //任务单编号

        editPersonId: "", //编制人员ID
        registDate: "", //承接日期
        name: "", //项目名称
        industryType: "", //行业类别
        type: "", //项目类别
        contractDate: "", //合同日期
        startDate: "", //任务下达日期
        timeLimit: "", //要求完成天数
        developmentOrganization: "", //建设单位
        province: "", //省
        city: "", //市
        area: "", //区
        address: "", //地址
        contact: "", //联系人
        contactPhone: "", //联系方式
        taskNumber: "", //任务单编号
        bankName: "", //开户银行
        bankAccount: "", //银行账号
        fund: "", //经费
        contractOrigin: "", //合同归属
        remark: "", //备注
        taxNumber: "" //税号
      },

      proType: [], //项目类别名单
      //editPeo: [], //项目编制人员名单
      dptList: [], //所有部门列表
      carerType: [], //所有行业类别
      allPeo: [], //所有人的名单
      allPeoPages: null,
      editPerList: [] //编制权限人名单
    };
  },
  created: function() {
    this.getinfo();
    this.getproType(); //项目类别
    this.getdepartments();

    this.getCarerType(); //行业类别
    this.getEditpersonList(); //编制人员
    this.getAllPeo(); //得到所有人
    //this.getundertakeDepartmentIName();
  },
  props: ["callbackdata"],
  methods: {
    getdepartments() {
      axios({
        method: "get",
        url: this.IP.IP + "/getDepartments"
      }).then(result => {
        // console.info("部门信息");
        // console.log(result);
        var data = result.data.data;
        this.dataTree = [];
        var i = 0;
        for (i = 0; i < data.length; i++) {
          this.setNode(data[i]);
        }
        this.dataTree = data;
        this.dataTree.unshift({ id: 0, name: "全部", children: [] });
        // console.info("部门树");
        // console.log(this.dataTree);
        // console.info("部门列表");
        // console.log(this.dptList);
        //console.info('')
        //console.log(this.valueId);
      });
    },
    setNode(node) {
      if (node != null) {
        node.name = node.nodeDepartmentIndex.name;
        node.id = node.nodeDepartmentIndex.id;
        node.children = node.childrenDepartmentIndexes;
        this.dptList.push({
          id: node.id + "",
          name: node.name
        });
        var i = 0;
        for (i = 0; i < node.childrenDepartmentIndexes.length; i++) {
          this.setNode(node.childrenDepartmentIndexes[i]);
        }
      }
    },
    getCarerType() {
      axios({
        method: "get",
        url: this.IP.IP + "/getIndustryTypes?pageNumber=" + 1
      }).then(result => {
        var total = result.data.data.total;
        var list = result.data.data.list;
        for (var i = 0; i < total; i++) {
          this.carerType.push({
            id: list[i].id + "",
            name: list[i].name + ""
          });
        }
        // console.info("行业类别名单");
        // console.log(this.carerType);
      });
    },
    getproType() {
      axios({
        method: "get",
        url: this.IP.IP + "/getProjectTypes?pageNumber=" + 1
      }).then(result => {
        var total = result.data.data.total;
        var list = result.data.data.list;
        for (var i = 0; i < total; i++) {
          this.proType.push({
            id: list[i].id + "",
            name: list[i].name + ""
          });
        }
        // console.info("项目类别");
        // console.log(this.proType);
      });
    },
    getinfo() {
      axios({
        method: "get",
        url:
          this.IP.IP + "/undertake/getUndertake?projectId=" + this.callbackdata
      }).then(result => {
        // console.log("123");
        this.infodetail = result.data.data;
        this.infodetail.undertake_departmentId =
          result.data.data.undertake_departmentId + "";
        this.infodetail.finishDepartmentId =
          result.data.data.finishDepartmentId + "";
        //console.log(this.undertakeDepartmentId);
        //console.log(result.data.data.undertakeDepartmentId);
        this.infodetail.industryType = result.data.data.industryType + "";
        this.infodetail.type = result.data.data.type + "";
      });
    }
  }
};
</script>
<style>
.auth-content {
  padding: 10px 5px;
  border-bottom: 1px dashed #cdcdcd;
}
</style>